package com.wys.mall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * ridission配置
 *
 * @Package com.wys.mall.product.config
 * @Author charlin
 * @Version: v1.0
 * @Date 2021-06-2910:01
 * @Copyright: 2021 www.wyscha.com Inc. All rights reserved.
 */
@Configuration
public class MyRedissionConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws IOException {
        Config config = new Config();
        //config.useClusterServers().addNodeAddress("127.0.0.1:6379");
        config.useSingleServer().setAddress("redis://192.168.16.149:6379");
        return Redisson.create(config);
    }
}
